package service;

import bean.pojo.GdUser;

public interface TokenService {
    /**
     * session失效时长
     */
    public final static int SESSION_TIMEOUT=2*60*60;
    /**
     * 置换保护时间
     */
    public final static int REPLACEMENT_PROTECTION_TIMEOUT=60*60;
    /**
     * 旧token延期失效时间
     */
    public final static int REPLACEMENT_DELAY=2*60;
    /**
     * 生成 保存 验证 删除 置换 获得
     */
    String generateToken(String userAgent,GdUser gdUser) throws Exception;
    boolean saveToken(String token,GdUser gdUser) throws Exception;
    boolean validate(String userAgent,String token) throws Exception;
    boolean delete(String token) throws Exception;
    boolean replace(String token) throws Exception;
    GdUser getUser(String token) throws Exception;
}
